home *** CD-ROM | disk | FTP | other *** search
/ Belgian Amiga Club - ADF Collection / BS1 part 05.zip / BS1 part 5 / GOD14-(412)695-3647.adf / SnoopDosV1.5.doc.pp / SnoopDosV1.5.doc
Text File  |  1992-08-04  |  16KB  |  314 lines

  1.  
  2.                 SnoopDos V1.5 -- Monitors AmigaDOS function calls
  3.  
  4.            (C) Copyright Eddy Carroll, July 1992. Freely Distributable.
  5.  
  6.  
  7. INTRODUCTION
  8.  
  9.     Have you ever wondered why a particular program won't seem to run?
  10.     It could be looking for some special files which you've forgotten to
  11.     install in the appropriate place. SnoopDos was designed to let you
  12.     resolve situations like this, though it's probably useful for other
  13.     things too.
  14.  
  15.     For those who don't like long instruction files, simply run SnoopDos
  16.     with no options, then run a few application programs and look at the
  17.     output displayed in SnoopDos's window. Interesting, eh? For those who'd
  18.     like a more detailed explanation, read on...
  19.  
  20.     When you start SnoopDos, it opens a console window. In this window
  21.     appears details of all calls made by any program on the system to the
  22.     CurrentDir(), DeleteFile, Execute(), LoadSeg(), Lock() and Open()
  23.     functions in the AmigaDOS library. The exception (as usual) is any
  24.     program written in BCPL; this includes most of the commands in the C:
  25.     directory.
  26.  
  27.     SnoopDos will tell you about all attempts to load libraries, devices
  28.     and fonts. It will also tell you if a program looks for a specific file
  29.     (for example in S:) or a specific disk volume or directory. This can be
  30.     very useful when you're playing with new software which may require
  31.     certain fonts or other support files.
  32.  
  33.     An unexpected bonus is that since AmigaDOS environment variables are
  34.     stored as files, SnoopDos will tell you the names of any environment
  35.     variables a program tries to read; if you see references to ENV:<name>
  36.     in the SnoopDos window, then a program is trying to access an environment
  37.     variable called <name>.
  38.  
  39.  
  40. USAGE
  41.  
  42.     When you start SnoopDos, it automatically detaches itself from the CLI
  43.     and runs in the background. You can specify a number of options on the
  44.     command line, either at this time or later on by running SnoopDos again.
  45.     Each option can be given in lower case or upper case to respectively
  46.     enable or disable that setting. Alternatively, you can follow the option
  47.     by `1' or `0' which has the same effect. So, `-d' and `-d1' both enable
  48.     the "Monitor DeleteFile()" option, whereas `-d' and `-d0' both disable
  49.     that option. Without further ado, here's an explanation of each setting:
  50.  
  51.     -a  Normally, SnoopDos uses different colours when displaying messages,
  52.         to allow events to be easily distinguished from each other. You can
  53.         force SnoopDos not to use any colour by disabling this option. This
  54.         can be useful if you only have a 2-colour workbench. If SnoopDos is
  55.         sending its output to a file, it turns off this option by default
  56.         (but you can turn it back on again if you like).
  57.  
  58.     -c  When this option is enabled, SnoopDos prints details of all calls
  59.         to the CurrentDir() function. A program calls CurrentDir() when it
  60.         wants to change its current directory to somewhere else. Note that
  61.         no result is displayed for this function, since AmigaDOS does not
  62.         allow for the possibility of it ever failing.
  63.  
  64.     -d  This option allows you to see all calls to the DeleteFile() function,
  65.         which is called whenever a program wants to delete a file. This can
  66.         be useful with unknown programs, to make sure that they don't do
  67.         anything nasty (though in fairness, there are much more effective
  68.         ways for a rogue program to do damage than by deleting a few files).
  69.  
  70.     -f  When enabled, this option causes SnoopDos to print out the full
  71.         path names for files. For example, if a program's current directory
  72.         is SYS:TOOLS and it tries to open a file called FOO, then the
  73.         filename would be displayed as SYS:TOOLS/FOO. Normally, it would
  74.         just be displayed as FOO. Filenames which are so expanded are
  75.         prefixed by a `>' character. Filenames which already included a full
  76.         path specification don't have this prefix. This allows you to
  77.         determine if the calling program specified the full path or not.
  78.  
  79.     -g  This option enables or disables the monitoring of AmigaDOS's
  80.         LoadSeg() function. This is used to read in a binary loadfile and is
  81.         most commonly used for loading in libraries, devices, fonts and
  82.         handlers, and by third-party DOS shells to load in external commands.
  83.  
  84.     -i  When this option is enabled, SnoopDos will ignore any calls to
  85.         Lock() by the Shell and calls to CurrentDir() by either the Shell
  86.         or Workbench. This can reduce the amount of output by quite a
  87.         bit under Kickstart 2.0, particularly when the Shell is searching
  88.         the command path for a command and Workbench is checking up on
  89.         the mounted disk volumes (which it does once a second). This
  90.         option is enabled by default, but you can turn it off with -i0 to
  91.         see what all the fuss is about.
  92.  
  93.     -l  This option enables or disables the monitoring of AmigaDOS's Lock()
  94.         function. Programs usually call this function to see if a particular
  95.         file exists, or as a prelude to some more sophisticated operation on
  96.         the file.
  97.  
  98.     -m  This option allows SnoopDos to be activated or deactivated while
  99.         still leaving it running. It is included merely for completeness;
  100.         a much easier way to achieve the same affect is to type CTRL-D or
  101.         CTRL-E in the SnoopDos window.
  102.  
  103.     -o  This option enables or disables the monitoring of AmigaDOS's Open()
  104.         function. Whenever a program wants to open a file for reading or
  105.         writing, it calls this function.
  106.  
  107.     -w  If several tasks try to call a particular DOS function at the same
  108.         time, SnoopDos can only handle them one at a time. Normally, what
  109.         will happen is that the other tasks speed on without waiting for
  110.         SnoopDos and you see a warning message saying that some function
  111.         calls were missed (this doesn't happen very often anyway). When the
  112.         `-w' option is enabled however, SnoopDos will make all the
  113.         different tasks queue up and take their turn.
  114.  
  115.         There is one important consequence of this: if a program tries to
  116.         access a file on a volume not currently mounted (causing AmigaDOS to
  117.         display a "Please insert volume xyzzy" requester), then SnoopDos will
  118.         print out the details about the file requested but not whether the
  119.         request succeeded or not; it can't do this until you respond to the
  120.         requester. In the meantime, other tasks may now be trying to call
  121.         AmigaDOS. For example, if you might try to pop open a new CLI with
  122.         Dmouse or PopCLI, so that you can do an ASSIGN to fake the requested
  123.         volume. All these tasks will have to wait until the original DOS
  124.         call has been completed.
  125.  
  126.         Since this can confuse things (though only for the user), the option
  127.         is disabled by default. You should only need it if you have to be
  128.         absolutely sure of catching every action made by several tasks.
  129.  
  130.     -x  This option enables or disables monitoring of Execute() calls.
  131.         Unlike most other DOS function calls, the return value from the
  132.         Execute() is NOT displayed; this is because when an Execute suceeds,
  133.         the command being executed will most likely making AmigaDOS calls of
  134.         of its own and if SnoopDos was waiting for Execute() to return, it
  135.         would skip printing these out.
  136.  
  137.         Some forms of Execute() will appear to have no associated command
  138.         to execute. This is normal, and occurs when a program redirects
  139.         command input from another file.
  140.  
  141.  
  142.     By default, Snoopdos operates as if you had started it with:
  143.  
  144.         SnoopDos -a1 -c1 -d1 -f0 -g1 -i1 -l0 -m1 -o1 -w0 -x1
  145.  
  146.     or for those who prefer to use the other command format:
  147.  
  148.         SnoopDos -a -c -d -F -g -i -L -m -o -w -x
  149.  
  150.     There are four additional options as well, which cause immediate
  151.     actions to be performed. These are:
  152.  
  153.     -h  Prints out a help screen for SnoopDos. Actually, typing any
  154.         unrecognised garbage after SnoopDos prints the help screen.
  155.  
  156.     -q  Sends a message to the version of SnoopDos currently running telling
  157.         it to remove itself. This is one way to quit SnoopDos, the other
  158.         way being to type CTRL-C in its window.
  159.  
  160.     -r  Prints out a brief report giving all the current settings for
  161.         SnoopDos (eagle-eyed users may spot a striking resemblance between
  162.         this display and the middle section of the help screen :-). Note
  163.         that all other command line options are ignored when you use -r.
  164.  
  165.     -z  Allows you to specify an alternative output file for SnoopDos to
  166.         send messages to. The filename can follow immediately after the -z,
  167.         or you can leave a space if you like.
  168.  
  169.         There are several uses for this function. First of all, you can use
  170.         it to change the location of the SnoopDos window when it opens, by
  171.         specifying a filename like -zCON:0/0/640/60/SnoopDos) (for a very
  172.         short window). You should always make sure the window is at least 77
  173.         columns wide or the output will look pretty messed up.
  174.  
  175.         If you specify -zSER: or -zAUX: then SnoopDos will send output to
  176.         the serial port at the baud rate specified in Preferences. AUX: is
  177.         slightly preferable to SER: since SnoopDos will then recognise the
  178.         CTRL-C, CTRL-D and CTRL-E characters when typed on the remote
  179.         terminal. If you are using a colour ANSI terminal, you may like to
  180.         re-enable colour by specifying `-a' in conjunction with this option.
  181.  
  182.         Finally, you can of course redirect output to a normal AmigaDOS file.
  183.         You would only want to do this if you wanted to keep a permanent
  184.         record of what went on on your system. This could be useful if you
  185.         allow remote access to your Amiga and want a record of what people
  186.         do on your system.
  187.  
  188.  
  189. THE SNOOPDOS WINDOW
  190.  
  191.     The SnoopDos window is divided into a number of columns, as follows:
  192.  
  193.     Process name
  194.         The name of the process (or CLI command) that is executing the
  195.         DOS call in question. If the DOS call is nested (see Res. below)
  196.         then the process name will be prefixed by '> '.
  197.  
  198.     Func
  199.         The function being executed (Open, Lock or Load). Open is printed
  200.         in white, Lock in orange and Load in black, to allow rows to be
  201.         quickly identifed at a glance. (Of course, if you've changed your
  202.         Preferences, the actual colours may be different.) Other values
  203.         which can appear here are Exec (for Execute), CD (for CurrentDir)
  204.         and Del (for DeleteFile).
  205.  
  206.     Filename
  207.         The name of the file being accessed. Remember that when the `-f'
  208.         option is enabled, this will be prefixed by a `>' character if the
  209.         filename displayed was expanded by SnoopDos to include the current
  210.         directory of the calling process.
  211.  
  212.     Mode
  213.         For Open(), this is OLD if an existing file is being opened or NEW
  214.         if a new file is being opened. For Lock(), this is SHAR if the lock
  215.         is a shared lock (i.e. several processes can access the same file) or
  216.         EXCL if it is an exclusive lock (only this process can access the
  217.         file). It remains empty for LoadSeg().
  218.  
  219.     Res.
  220.         The result of the DOS call. This is either `Okay' in white or
  221.         `Fail' in orange. In general, you learn much more from the `Fail'
  222.         entries (i.e. the things the program tried to find but couldn't).
  223.  
  224.         Occasionally, you may see a `>>>>' appearing here. This happens if
  225.         some other program has also patched DOS library in such a way that
  226.         the function currently being called calls another DOS function
  227.         itself. One such program is Rez, which tries to open a program file
  228.         for reading if you LoadSeg() it. In this case, the `>>>>' indicates
  229.         that DOS calls are being nested. The DOS calls which are nested
  230.         will have the associated process name prefixed by `> ' when they
  231.         are displayed. `> (Done)' is displayed when the top level DOS
  232.         function exits, and the exit status is displayed on the same
  233.         line in the Res. column as normal.
  234.  
  235.     You can type several keys into the SnoopDos window. CTRL-C will terminate
  236.     SnoopDos. CTRL-D will disable monitoring temporarily (and print a brief
  237.     message to that effect); CTRL-E enables it again. Pressing Space or any
  238.     other key will pause the output to the window, as in a CLI window. Press
  239.     BackSpace to continue. Note that if you have the `-w' option enabled and
  240.     you pause the output, all functions for which monitoring is enabled will
  241.     cause the calling process to go to sleep until you restart output again.
  242.  
  243.     When SnoopDos wants to quit, it makes sure that nobody else has patched
  244.     the DOS library after it. If something has, SnoopDos will refuse to exit
  245.     immediately. Instead, it will check approximately every 5 seconds to
  246.     see if it is safe to exit and as soon as it can, it will.
  247.  
  248.  
  249. TRICKS AND TIPS
  250.  
  251.     Some users have been asking for a scrollback facility in the SnoopDos
  252.     window, and also a close gadget. A future version of SnoopDos may
  253.     include a full GUI with these features and much more, but for now,
  254.     you can use the following very kludgey workarounds if you like:
  255.  
  256.     Scroll bar: The freely distributable console handler SPHINX: can
  257.     be used to provide this facility. Use a command line like:
  258.  
  259.         SnoopDos -zSPHINX:////SnoopDos
  260.  
  261.     to open the window. One problem is that the current version of Sphinx
  262.     (V2.6x) skips to a new line when it sees a carriage return character;
  263.     this tends to double-space all the output from SnoopDos. Hopefully a
  264.     future version of Sphinx will fix this bug.
  265.  
  266.     You can also use the freely distributable CB program (V1.1), though this
  267.     is a little more involved; open a new shell window, run CB, and then
  268.     start SnoopDos with the line:
  269.  
  270.         SnoopDos -z*
  271.  
  272.     This tells SnoopDos to redirect its output to the current CLI window,
  273.     and so it will benefit from CB's scrollback facilities.
  274.  
  275.     CLOSE Gadget: This is even more kludgey, but if you absolutely must
  276.     have one, you can do it under Workbench 2.0 like this. Create a batch
  277.     file called S:Start-SnoopDos containing the following:
  278.  
  279.         SnoopDos -z*
  280.         Ask "Press RETURN or click the close gadget to quit SnoopDos"
  281.         SnoopDos -q
  282.         EndCli >NIL:
  283.  
  284.     Then create a shell alias like this:
  285.  
  286.         Alias Snoop "NewCli con:0/0/640/200/Snoop/CLOSE from s:Start-SnoopDos"
  287.  
  288.     Then when you type Snoop into a Shell window, SnoopDos will start up in
  289.     its own Window and clicking the close gadget in that window will remove
  290.     it. Be warned though; CTRL-C, CTRL-D and CTRL-E will no longer work
  291.     properly, and pressing RETURN will also close the window.
  292.  
  293.     What can I say ... when I have time, I'll write a proper GUI version.
  294.  
  295.  
  296. AUTHOR
  297.  
  298.     Eddy Carroll
  299.  
  300.     Email:     ecarroll@maths.tcd.ie
  301.     Phone:     +353-1-2874566
  302.     Fax:       +353-1-2875663
  303.     Snailmail: The Old Rectory, Delgany, Co. Wicklow, Ireland.
  304.  
  305.  
  306. DISTRIBUTION
  307.  
  308.     SnoopDos may be freely distributed as long as no charge is made other
  309.     than to cover time and copying costs. If you want to include SnoopDos
  310.     as part of a commercial package (somehow I doubt it but it never hurts
  311.     to mention :-) then contact the author listed above. Fred Fish is
  312.     specifically given permission to include SnoopDos in his fine disk
  313.     collection.
  314.